//
// Created by xqyr on 2025/3/30.
//

#ifndef FSERVICE_FSERVICE_H
#define FSERVICE_FSERVICE_H

#include <common_base/fdbus.h>
#include <common_base/CFdbProtoMsgBuilder.h>
#include <common_base/cJSON/cJSON.h>
#include <common_base/CFdbCJsonMsgBuilder.h>

class FService : public CBaseServer
 {
public:
    explicit FService(const char *name, CBaseWorker *worker = nullptr);
    static void * startServer(void *arg);
protected:
    /* called when connected to the server */
    void onOnline(FdbSessionId_t sid, bool is_first) override;

    /* called when disconnected from server */
    void onOffline(FdbSessionId_t sid, bool is_last) override;

    /* called when events broadcasted from server is received */
    void onBroadcast(CBaseJob::Ptr &msg_ref) override;

    /* called when client calls invoke() */
    void onInvoke(CBaseJob::Ptr &msg_ref) override;

    /* called when client call subscribe() to register message */
    void onSubscribe(CBaseJob::Ptr &msg_ref) override;


};


#endif //FSERVICE_FSERVICE_H
